home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************
- * tiff2fbm.c: FBM Release 1.0 25-Feb-90 Michael Mauldin
- *
- * Copyright (C) 1989,1990 by Michael Mauldin. Permission is granted
- * to use this file in whole or in part for any purpose, educational,
- * recreational or commercial, provided that this copyright notice
- * is retained unchanged. This software is available to all free of
- * charge by anonymous FTP and in the UUNET archives.
- *
- * tiff2fbm.c:
- * Convert a TIFF format image to FBM format. Uses Sam Leffler's
- * libtiff.a TIFF image library to read TIFF format. See also,
- * fbm2tiff for the opposite conversion.
- *
- * USAGE
- * % tiff2fbm [ -<num> ] foo.tif > foo.fbm
- *
- * EDITLOG
- * LastEditDate = Mon Jun 25 00:18:45 1990 - Michael Mauldin
- * LastFileName = /usr2/mlm/src/misc/fbm/tiff2fbm.c
- *
- * HISTORY
- * 25-Jun-90 Michael Mauldin (mlm@cs.cmu.edu) Carnegie Mellon
- * Package for Release 1.0
- *
- * 20-Jun-90 Paul Milazzo (milazzo) at BBN
- * Patched for STDC.
- *
- * 14-Jun-89 Michael Mauldin (mlm) at Carnegie-Mellon University
- * Created. Based on tiff2ps by Sam Leffler.
- *****************************************************************/
-
- # include <stdio.h>
- # include <ctype.h>
- # include "fbm.h"
-
- # define USAGE "Usage: tiff2fbm [ -<num> ] foo.tif > foo.fbm"
-
- /****************************************************************
- * main
- ****************************************************************/
-
- #ifndef lint
- static char *fbmid =
- "$FBM tiff2fbm.c <1.0> 25-Jun-90 (C) 1989,1990 by Michael Mauldin, source \
- code available free from MLM@CS.CMU.EDU and from UUNET archives$";
- #endif
-
- main (argc, argv)
- char *argv[];
- { FBM image;
- double aspect = 0.0;
- char *fname = NULL, *title = NULL, *credits = NULL;
- int outtype = FMT_FBM;
-
- /* Get the options */
- while (--argc > 0 && (*++argv)[0] == '-')
- { while (*++(*argv))
- { switch (**argv)
- {
- case 'a': aspect = atof (*argv+1); SKIPARG; break;
- case 't': title = *argv+1; SKIPARG; break;
- case 'c': credits = *argv+1; SKIPARG; break;
- case 'A': outtype = FMT_ATK; break;
- case 'B': outtype = FMT_FACE; break;
- case 'F': outtype = FMT_FBM; break;
- case 'G': outtype = FMT_GIF; break;
- case 'I': outtype = FMT_IFF; break;
- case 'J': outtype = FMT_JPEG; break;
- case 'M': outtype = FMT_MCP; break;
- case 'P': outtype = FMT_PBM; break;
- case 'R': outtype = FMT_RLE; break;
- case 'S': outtype = FMT_SUN; break;
- case 'T': outtype = FMT_TIFF; break;
- case 'X': outtype = FMT_X11; break;
- case 'Z': outtype = FMT_PCX; break;
- default: fprintf (stderr, "%s\n", USAGE);
- exit (0);
- }
- }
- }
-
- /* Get name of input file */
- if (argc != 1)
- { fprintf (stderr, "%s\n", USAGE);
- exit (1);
- }
-
- fname = *argv;
-
- if (read_tiff (&image, fname) &&
- write_bitmap (&image, stdout, outtype))
- { exit (0); }
-
- exit (1);
- }
-